package de.hsma.srn.controller;

import java.awt.EventQueue;

import de.hsma.srn.model.account.DomainModel;
import de.hsma.srn.view.MainView;
import de.hsma.srn.view.console.IConsole;
//import de.hsma.srn.view.console.MainConsole;

public class Run {

	public Run() {
	}

	public void startKeyBoxApplication() {
		EventQueue.invokeLater(new Runnable() {

			@Override
			public void run() {
				try {
					DomainModel model = new DomainModel();
					MainController controller = new MainController(model);
					MainView view = new MainView(controller);
					//MainConsole consoleView = new MainConsole(controller);
					controller.addListener(view);
					//controller.addListener(consoleView);
					//Thread t = new Thread(new ConsoleRunner(consoleView));
					//t.start();
					view.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
}

class ConsoleRunner implements Runnable {
	private IConsole mConsoleView;
	
	public ConsoleRunner(IConsole consoleView) {
		this.mConsoleView = consoleView;
	}
	
	@Override
	public void run() {
		this.mConsoleView.showDialog();
	}
	
}
